#include<bits/stdc++.h>
#define int long long
using namespace std;
namespace IO
{
	template<typename T>
	void read(T &_x){_x=0;int _f=1;char ch=getchar();while(!isdigit(ch)) _f=(ch=='-'?-1:_f),ch=getchar();while(isdigit(ch)) _x=_x*10+(ch^48),ch=getchar();_x*=_f;}
	template<typename T,typename... Args>
	void read(T &_x,Args&...others){Read(_x);Read(others...);}
	const int BUF=20000000;char buf[BUF],to,stk[32];int plen;
	#define pc(x) buf[plen++]=x
	#define flush(); fwrite(buf,1,plen,stdout),plen=0;
	template<typename T>inline void print(T x){if(!x){pc(48);return;}if(x<0) x=-x,pc('-');for(;x;x/=10) stk[++to]=48+x%10;while(to) pc(stk[to--]);}
}
using namespace IO;
const int N = 5e5+10;
int n,k,d,a[N],f[N],t[N],v[N],p2[N],cnt,sum,j;
priority_queue<int>p,p1; 
vector<int>w[N];
signed main()
{
	freopen("holiday.in","r",stdin);
	freopen("holiday1.out","w",stdout);
	read(n),read(k),read(d);
	for(int i = 1;i <= n;i++) f[i] = -1e11;
	for(int i = 1;i <= n;i++) read(a[i]);
	for(int i = 1;i < n;i++) read(t[i]);
	f[1] = a[1];
	for(int i = 1;i < n;i++)
		for(int j = i+1;j <= i+t[i] && j <= n;j++) 
			f[j] = max(f[j],f[i]+a[j]-(j-i)/k*d);
	print(f[n]); flush();
	return 0;
}
